dt={}
while True:
    try:
        number=int(input())
        dt[number]=dt.get(number,0)+1
    except:
        break
result=[]
for x in dt.items():
    result.append(x)
result.sort(key=lambda x:x[1])
print(f"{result[0][0]} {result[0][1]}")